import 'package:ReadDB/model/widget_db_repository.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'model/read_db.dart';

final storage = DbManager();

class PorviderWrapper extends StatelessWidget {
  final Widget child;

  PorviderWrapper({this.child});

  final repository = WidgetDbRepository(storage);

  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        FutureProvider<DbManager>(
          create: (BuildContext context) => storage.init(),
          child: child,
        ),
      ],
      child: child,
    );
  }
}
